package com.dsi.capa.db.dao;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;

import javax.sql.DataSource;

import com.dsi.capa.db.model.Usuario;

public class CarreraDAO  extends BasicDAO<Usuario>{


	public CarreraDAO() {
		super();
	}

	public CarreraDAO(DataSource ds) {
		super(ds);
	}

	public HashMap<String, String> findCarreras() {
		Usuario u = new Usuario();
		HashMap<String,String> aux = new HashMap<String, String>();
		int lastRow = 0;
		StringBuffer sql = new StringBuffer();
		sql.append("select CODIGOCARRERA,NOMBRECARRERA from carrera");
		

		try {
			preparedStatement = getConnection()
					.prepareStatement(sql.toString());
			

			resultSet = preparedStatement.executeQuery();

			if (resultSet.next()) {
				String k=resultSet.getString("CODIGOCARRERA");
				String v= resultSet.getString("NOMBRECARRERA");
				aux.put(v,k);
				
				
			}
		} catch (SQLException e) {
			e.printStackTrace();
		} finally {
			closeConnection();
		}

		return aux;
	}

	@Override
	public void save(Usuario target) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void update(Usuario target) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void delete(Usuario target) {
		// TODO Auto-generated method stub
		
	}

	
	@Override
	public List<Usuario> findAll(Integer firstRow, Integer maxRows) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<Usuario> findAll() {
		// TODO Auto-generated method stub
		return null;
	}
}
